package net.wds.study.student.service.impl;

import net.wds.study.student.dao.StudentDao;
import net.wds.study.student.entity.Student;
import net.wds.study.student.modal.PageModal;
import net.wds.study.student.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by sidongliang on 2020/9/7.
 */
@Service("studentService")
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDao studentDao;

    @Override
    public boolean login(String no, String pwd) {
        if(no==null || "".equals(no.trim())){
            return false;
        }
        if(pwd==null || "".equals(pwd.trim())){
            return false;
        }
        return studentDao.login(no.trim(),pwd.trim());
    }
    /**
     * @Author GongFan
     * @Description
     * @Date 2020/9/7 22:54
     * @Param [startIndex, pageSize, name, sex]    当前页起始索引   每页数据条数  参数列表
     * @return net.wds.study.student.modal.PageModal<net.wds.study.student.entity.Student>
     **/

    @Override
    public PageModal<Student> getPageByParam(int startIndex, Integer pageSize, String name, Integer sex) {

        if(startIndex<0){
            startIndex = 0;
        }
        return studentDao.getPageByParam(startIndex,pageSize,name,sex);
    }
}
